package com.mubei.seckill.util;

import org.apache.commons.lang3.StringUtils;
import org.junit.Test;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @author 帅小伙
 * @date 2022/2/18
 * @description
 *
 * 登录验证手机号
 */
public class ValidatorUtil {

    private static final Pattern mobile_pattern  = Pattern.compile("1(3\\d|4[5-9]|5[0-35-9]|6[2567]|7[0-8]|8\\d|9[0-35-9])\\d{8}");

    public static  boolean IsMobile(String str) {
        if(StringUtils.isEmpty(str)) return false;
        Matcher matcher = mobile_pattern.matcher(str);
        return matcher.matches();
    }


    @Test()
    public void test() {
        System.out.println(ValidatorUtil.IsMobile("15557891523"));
        System.out.println(ValidatorUtil.IsMobile("1555789523"));
    }
}
